<?php

namespace app\admin\model\dahuis;

use think\Model;

class Sbgjj extends Model
{
    // 表名
    protected $name = 'dahuis_sbgjj';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'isxy_text'
    ];
    

    
    public function getIsxyList()
    {
        return ['未续约' => __('未续约'),'已续约' => __('已续约')];
    }     


    public function getIsxyTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['isxy']) ? $data['isxy'] : '');
        $list = $this->getIsxyList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function admin()
    {
        return $this->belongsTo('app\admin\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }



}
